package com.lin.chapter6;

import java.text.NumberFormat;
import java.util.ArrayList;

public class BookStore {
	private final static ArrayList<IBook> bookList = new ArrayList<IBook>();

	static {
		bookList.add(new OffNovelBook("天龙八部", 3200, "金庸"));
		bookList.add(new OffNovelBook("巴黎圣母院", 5600, "雨果"));
		bookList.add(new OffNovelBook("悲惨世界", 3500, "雨果"));
		bookList.add(new OffNovelBook("金瓶梅", 4300, "兰陵笑笑生"));
		bookList.add(new ComputerBook("Think in Java", 4300, "Bruce Eckel", "编程语言"));
	}

	public static void main(String[] args) {
		NumberFormat numberFormat = NumberFormat.getCurrencyInstance();
		numberFormat.setMaximumFractionDigits(2);
		System.out.println("------------书店卖出去的书籍记录如下：--------------");
		for (IBook iBook : bookList) {
			System.out.println("书籍名称：" + iBook.getName() + "\t书籍作者：" + iBook.getAuthor() +
			"\t书籍价格：" + numberFormat.format(iBook.getPrice()/100) + "元");
		}
	}
}
